﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using WorkRecorder.Business;
using System.Collections.ObjectModel;
using System.Windows.Controls;
using System.Threading;
using System.Globalization;

namespace WorkRecorder.Helpers.Converters
{
    public class DateTimeConverter : IValueConverter
    {


        public DateTimeConverter() { }

 
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {//Converter={StaticResource dateTimeConv}, ConverterParameter=dat
            string result = "";
            //Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");

            if (parameter.ToString().Equals("date"))
            {
                result = ((DateTime)value).ToString("d");
            }
            else if (parameter.ToString().Equals("time"))
            {
                result = ((DateTime)value).ToString("t");

            }

            return result;
 
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
